Glasgow | 25-ITP-SEP | Fares Bakhet | Sprint 2 | Book-library#345
Glasgow | 25-ITP-SEP | Fares Bakhet | Sprint 2 | Book-library#345Fares-Bakhet wants to merge 4 commits intoCodeYourFuture:mainfrom
Conversation
cjyuan
left a comment
There was a problem hiding this comment.
Can you check if any of this general feedback can help you further improve your code?
https://github.com/cjyuan/Module-Data-Flows/blob/book-library-feedback/debugging/book-library/feedback.md
Doing so can help me speed up the review process. Thanks.
| <script src="script.js"></script> | ||
| <script type="module"> | ||
| class Book { | ||
| constructor(title, author, pages, read) { | ||
| this.title = title; | ||
| this.author = author; | ||
| this.pages = pages; | ||
| this.read = read; | ||
| } | ||
| } | ||
|
|
||
| const library = [ | ||
| new Book("Robinson Crusoe", "Daniel Defoe", 252, true), | ||
| new Book("The Old Man and the Sea", "Ernest Hemingway", 127, true) | ||
| ]; |
There was a problem hiding this comment.
Why keep the JS code in this HTML file? Should I be reviewing the code in the HTML file or those in script.js?
cjyuan
left a comment
There was a problem hiding this comment.
Changes look great. Just one question.
| <td>${book.title}</td> | ||
| <td>${book.author}</td> |
There was a problem hiding this comment.
Can you suggest an approach to combat special characters such as '<' and '&' that may exist in a book title? If these characters are not handled properly, they may ruin the display.
There was a problem hiding this comment.
You could also write a function to escape the special characters in the string. (Just ask AI. The function is just a few lines of code).
Then you would be able to express something like:
`...
<td>${escape(book.title)}</td>
<td>${escape(book.author)}</td>
...
`
This way, you can keep using your approach to construct the elements.
Learners, PR Template
Self checklist
Changelist
Complete the book library adjustments.
Questions
No questions.